﻿@inject IStringLocalizer<Foo> Localizer

<ContextMenuZone>
    <Table TItem="Foo" Items="@Items.Take(3)">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" />
        </TableColumns>
    </Table>
    <ContextMenu>
        <ContextMenuItem Text="拷贝" OnClick="OnCopy"></ContextMenuItem>
        <ContextMenuItem Icon="fa-solid fa-paste" Text="粘贴" OnClick="OnPaste"></ContextMenuItem>
    </ContextMenu>
</ContextMenuZone>

@code {
    [NotNull]
    private List<Foo>? Items { get; set; }

    /// <summary>
    /// OnInitialized
    /// </summary>
    protected override void OnInitialized()
    {
        Items = Foo.GenerateFoo(Localizer);
    }

    private Task OnCopy(ContextMenuItem item, object value)
    {
        return Task.CompletedTask;
    }

    private Task OnPaste(ContextMenuItem item, object value)
    {
        return Task.CompletedTask;
    }
}
